<template>
  <div>
    <el-select
      v-model="value"
      placeholder="请选择"
      @change="setVal"
    >
      <template v-for="item in options">
        <el-option
          :key="item.id"
          :label="item.label"
          :value="item.id"
          :disabled="item.disabled"
        >
        </el-option>
        <options
          :options="item.children"
          :level="1"
          :key="'option'+item.id"
          v-if="item.children"
        >
        </options>
      </template>

    </el-select>
  </div>

</template>

<script>
import options from "./options";
export default {
  components: { options },
  name: "select-tree",
  props: {
    options: {
      type: Array,
      default: []
    }
  },
  data() {
    return {
      value: null
    };
  },
  methods: {
    setVal(val) {
      this.$emit("change", this.value);
    }
  }
};
</script>

<style lang="scss" scoped>
</style>
